<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta charset="UTF-8">
    <title>12 自定义指令</title>
    <script src="../angular-1.5.8/angular.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<div>
    <mytem text="这是第一个text" text2="这是第二个"></mytem>
</div>

<script>
    var app = angular.module("myApp", [])
    app.controller("myCtrl",function ($scope) {
//        $scope.add = "这是啥啊这"
    })
//    若使用 myTem ,则在html里面的标签应该写成 <my-tem></my-tem>
    app.directive("mytem",function () {
        return {
            template:"<div><h1>{{text}}</h1><h2>{{text2}}</h2></div>",
            transclude:true,
            scope:{
                text:"@",
                text2:"@"
            }

        }
    })
</script>
</body>
</html>